(function(){"use strict";BX.namespace("BX.UI.Counter");BX.UI.Counter=function(t){this.options=BX.type.isPlainObject(t)?t:{};this.container=null;this.counterContainer=null;this.value=0;this.animate=false;this.color=BX.UI.Counter.Color.DANGER;this.size=BX.UI.Counter.Size.MEDIUM;this.setValue(t.value);this.setColor(t.color);this.setSize(t.size);this.setAnimate(t.animate)};BX.UI.Counter.Color={DANGER:"ui-counter-danger",SUCCESS:"ui-counter-success",PRIMARY:"ui-counter-primary",GRAY:"ui-counter-gray",LIGHT:"ui-counter-light",DARK:"ui-counter-dark"};BX.UI.Counter.Size={LARGE:"ui-counter-lg",MEDIUM:"ui-counter-md"};BX.UI.Counter.prototype={getValue:function(){return this.value},setValue:function(t){if(BX.type.isNumber(t)){this.value=t<0?0:t}},setColor:function(t){if(BX.type.isNotEmptyString(t)){BX.removeClass(this.getContainer(),this.color);this.color=t;BX.addClass(this.getContainer(),this.color)}},setSize:function(t){if(BX.type.isNotEmptyString(t)){BX.removeClass(this.getContainer(),this.size);this.size=t;BX.addClass(this.getContainer(),this.size)}},setAnimate:function(t){this.animate=t},update:function(t){if(this.animate===true){this.updateAnimated(t)}else{this.setValue(t);BX.adjust(this.counterContainer,{text:this.getValue()})}},updateAnimated:function(t){if(t>this.getValue()){BX.addClass(this.counterContainer,"ui-counter-plus")}else{BX.addClass(this.counterContainer,"ui-counter-minus")}this.setValue(t);setTimeout(function(){BX.removeClass(this.counterContainer,"ui-counter-plus");BX.removeClass(this.counterContainer,"ui-counter-minus")}.bind(this),500);setTimeout(function(){BX.adjust(this.counterContainer,{text:this.getValue()})}.bind(this),250)},getCounterContainer:function(){if(this.counterContainer===null){this.counterContainer=BX.create("div",{props:{className:"ui-counter-inner"},text:this.getValue()})}return this.counterContainer},getContainer:function(){if(this.container===null){this.container=BX.create("div",{props:{className:"ui-counter"},children:[this.getCounterContainer()]})}return this.container}}})();
//# sourceMappingURL=ui.cnt.map.js